


//
//  mysw.swift
//  mywei
//
//  Created by myd on 15/12/17.
//  Copyright © 2015年 myd1. All rights reserved.
//

import UIKit

extension UIWindow
{
 
    func loadnowvrdion()
    {
      let Key : String = "CFBundleVersion"
        let nowvrdion = NSBundle.mainBundle().infoDictionary![Key] as! String
        NSUserDefaults.standardUserDefaults().setObject(nowvrdion, forKey: Key)
    }
    func login()
    {
      
        if user1.loadboo(){
       
           let Key : String = "CFBundleVersion"
   let vrdion = NSUserDefaults.standardUserDefaults().objectForKey(Key) as? String
    let cureevrdion = NSBundle.mainBundle().infoDictionary![Key] as! String
        if  !(cureevrdion == vrdion)
        {
        self.rootViewController = newcollection()
        }
        
        else
        {
       self.rootViewController = WellCome()
            }}else
        {
             self.rootViewController = MainTabBarController()
        }
        self.makeKeyAndVisible()
    }
}
extension NSObject
{
        typealias ErrorFunc = (resuit : [String : AnyObject]?, Error : NSError?) -> ()
}
extension UIBarButtonItem
{
   class func setna(image : String) -> UIButton
    {
        let button = UIButton()
        button.setImage(UIImage(named: image), forState: UIControlState.Normal)
        button.setImage(UIImage(named: image + "_highlighted"), forState: UIControlState.Highlighted)
        button.sizeToFit()
        return button
    }
    convenience init(image : String) {
        
        let button = UIButton()
        button.setImage(UIImage(named: image), forState: UIControlState.Normal)
        button.setImage(UIImage(named: image + "_highlighted"), forState: UIControlState.Highlighted)
        button.sizeToFit()
      
        self.init(customView : button)
        
        
    }
}